<template>
  <div>
    <h2>Home</h2>
    <!-- <router-link :to="{ name: 'music' }"> music </router-link>
    <router-link :to="{ name: 'news' }"> news </router-link> -->

    <!-- params传参字符串 -->
    <!-- <router-link to="/home/music/1/4min"> 华语music </router-link>
    <router-link to="/home/music/2/3min"> news </router-link> -->

    <!-- params传参对象写法 -->
    <!-- 注意事项: - to的对象写法中,如果和params一起使用,则不能书写path,只能使用name
    - 可选的params参数,要么不写,要么写一个undefined做为值,不能书写一个空字符串 -->
    <router-link
      :to="{
        name: 'music',
        params: {
          id: '1',
          time: undefined,
        },
      }"
    >
      华语music</router-link
    >

    <router-link
      :to="{
        name: 'music',
        params: {
          id: '2',
          time: undefined,
        },
      }"
    >
      粤语music
    </router-link>

    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "Home",
};
</script>

<style>
</style>